home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / ARMLINUX / MAIL / 9804 / 000089_pb@nexus.co.uk _Mon Apr 20 12:26:58 1998.msg < prev    next >
Internet Message Format  |  1998-05-13  |  2KB

  1. Return-Path: <pb@nexus.co.uk>
  2. Received: from globe (nexusel.demon.co.uk [158.152.30.195])
  3.     by odie.barnet.ac.uk (8.8.6/8.8.6) with SMTP id MAA15613
  4.     for <willy@odie.barnet.ac.uk>; Mon, 20 Apr 1998 12:26:56 +0100
  5. Received: from (spring.nexus.co.uk) [192.0.0.3] (root)
  6.     by globe with smtp (Exim 1.82 #1)
  7.     id 0yREcS-00004h-00; Mon, 20 Apr 1998 12:20:16 +0100
  8. Received: from localhost (spring.nexus.co.uk) [127.0.0.1] (pb)
  9.     by spring.nexus.co.uk with esmtp (Exim 1.82 #1)
  10.     id 0yREXv-00009W-00; Mon, 20 Apr 1998 12:15:35 +0100
  11. X-Mailer: exmh version 2.0zeta 7/24/97
  12. To: Matthew Wilcox <willy@odie.barnet.ac.uk>
  13. cc: linux-arm@vger.rutgers.edu, mdw@ebi.ac.uk
  14. Subject: Re: strchr.S 
  15. In-reply-to: Your message of "Mon, 20 Apr 1998 11:52:59 BST."
  16.              <199804201053.LAA15415@odie.barnet.ac.uk> 
  17. Mime-Version: 1.0
  18. Content-Type: text/plain; charset=us-ascii
  19. Date: Mon, 20 Apr 1998 12:15:34 +0100
  20. From: Philip Blundell <pb@nexus.co.uk>
  21. Message-Id: <E0yREXv-00009W-00@spring.nexus.co.uk>
  22. Status: RO
  23.  
  24. >Here's a 39-instruction of strchr which works word-at-a-time.  I have
  25. >neither tested nor benchmarked it.  Phil, does glibc have a testsuite
  26. >for strchr?  If not, I ought to write one - there are so many cases to
  27. >take care of.
  28.  
  29. Yes, we do have one.  Here's the code.  If you can think of additional tests 
  30. to add then please do.
  31.  
  32. void
  33. test_strchr (void)
  34. {
  35.   it = "strchr";
  36.   check (strchr ("abcd", 'z') == NULL, 1);    /* Not found. */
  37.   (void) strcpy (one, "abcd");
  38.   check (strchr (one, 'c') == one+2, 2);    /* Basic test. */
  39.   check (strchr (one, 'd') == one+3, 3);    /* End of string. */
  40.   check (strchr (one, 'a') == one, 4);        /* Beginning. */
  41.   check (strchr (one, '\0') == one+4, 5);    /* Finding NUL. */
  42.   (void) strcpy (one, "ababa");
  43.   check (strchr (one, 'b') == one+1, 6);    /* Finding first. */
  44.   (void) strcpy (one, "");
  45.   check (strchr (one, 'b') == NULL, 7);        /* Empty string. */
  46.   check (strchr (one, '\0') == one, 8);        /* NUL in empty string. */
  47.   {
  48.     char buf[4096];
  49.     int i;
  50.     char *p;
  51.     for (i=0; i < 0x100; i++)
  52.       {
  53.     p = (char *) ((unsigned long int) (buf + 0xff) & ~0xff) + i;
  54.     strcpy (p, "OK");
  55.     strcpy (p+3, "BAD/WRONG");
  56.     check (strchr (p, '/') == NULL, 9+i);
  57.       }
  58.    }
  59. }
  60.  
  61. p.
  62.